package com.cat.dataStructure03;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/count-collisions-of-monkeys-on-a-polygon/
 * @create 2025/11/16 09:52
 * @since JDK17
 */

public class Solution64 {
    int N = ((int) 1e9) + 7;
    int pow(int n) {
        long ans = 1, x = 2;
        while (n > 0) {
            if ((n & 1) != 0) {
                ans = (ans * x) % N;
            }
            x = (x * x) % N;
            n >>= 1;
        }

        return ((int) ans);
    }
    public int monkeyMove(int n) {
        return (pow(n) - 2 + N) % N;
    }
}
